home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / WIN_PRO / VIEWS.ZIP;1 / CVDZIP.EXE / CVINTRVW.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-22  |  2.6 KB  |  150 lines

  1. /*
  2.     cvintrvw.cpp
  3.  
  4.     Intro window (C++/Views window)
  5.     
  6.     C++/Views 2.0 Demo
  7.     Copyright (c) 1992, by Liant Software Corp.
  8.     ALL RIGHTS RESERVED.
  9.  
  10.     Revision History:
  11.     -----------------
  12. */
  13.  
  14. #include "cvintrvw.h"
  15. #include "cvdemovw.h"
  16. #include "editbox.h"
  17. #include "messengr.h"
  18. #include "port.h"
  19.  
  20. defineClass(IntroView, VMdiView)
  21.  
  22. IntroView::IntroView()
  23. {
  24.     ;
  25. }
  26.  
  27. IntroView::IntroView(VFrame &f, DemoAppView *parent)
  28.     : VMdiView("IntroIcon", f, (VWindow *) parent, StyleBorder | StyleTitle | StyleCloseBox | StyleSizable)
  29. {
  30.     mainWin = parent;
  31.  
  32.     setTitle("Welcome");
  33.  
  34.     /* create an editbox to display startup text */
  35.     VEditBox *eb;
  36.  
  37.     eb = new VEditBox(VFrame(0.05F, 0.5F, 0.9F, 0.35F), this,
  38.                     StyleBorder | StyleVertical | StyleWordWrap | StyleReadOnly);
  39.  
  40.     eb->putText(cvTextFile->getMessage("Startup:Text").gets());
  41.     eb->takeFocus();
  42.  
  43.     /* make sure the "About this Window" data is set up */
  44.     mainWin->setAboutNames("Intro:About", "cvintrvw.cpp");
  45. }
  46.  
  47. IntroView::~IntroView()
  48. {
  49.     ;
  50. }
  51.  
  52. boolean IntroView::free()
  53. {
  54.     delete this;
  55.     return(TRUE);
  56. }
  57.  
  58. boolean IntroView::close()
  59. /*
  60.     The user has closed the window.
  61.     Notify the main window so that it can update the main menu bar
  62. */
  63. {
  64.     mainWin->introView = 0;
  65.     mainWin->updateMenu();
  66.     return(FALSE);
  67. }
  68.  
  69. boolean IntroView::paint()
  70. /*
  71.     Draw the C++/Views banner
  72. */
  73. {
  74.     VPort p(this);
  75.     VPen  pn;
  76.     VBrush br(BLUE);
  77.     VRectangle    rect;
  78.  
  79.     int x, y, w, h;
  80.     int points = 80;
  81.     int off = 3;
  82.     getArea(&x, &y, &w, &h);
  83.  
  84.     /* adjust size of font based on size of window */
  85.     if (w < 550) {
  86.         points = 50;
  87.         off = 2;
  88.     }
  89.     if (w < 350) {
  90.         points = 25;
  91.         off = 2;
  92.     }
  93.     if (w < 125) {
  94.         points = 12;
  95.         off = 1;
  96.     }
  97.     if (w < 75) {
  98.         points = 8;
  99.         off = 1;
  100.     }
  101.  
  102.     VFont fbig("New Times Roman", points);
  103.  
  104.     rect.set(CornerDim, x, y, w, h);
  105.  
  106.     p.open();
  107.     p.useFont(&fbig);
  108.     p.usePen(&pn);
  109.     p.useBrush(&br);
  110.  
  111.     pn.color(BLUE);
  112.  
  113.     p.fillRegion(&rect);
  114.  
  115.     rect.set(CornerDim, x, y + h/6, w, h / 2);
  116.  
  117.     rect.move(off, off);
  118.     pn.color(GRAY);
  119.     p.wrtText("C++/ Views", &rect, JustifyCenter);
  120.  
  121.     rect.move(-off, -off);
  122.     pn.color(WHITE);
  123.     p.wrtText("C++/ Views", &rect, JustifyCenter);
  124.  
  125.     p.close();
  126.  
  127.     return(TRUE);
  128. }
  129.  
  130. boolean IntroView::erased()
  131. /*
  132.     Intercept automatic background erasure.
  133. */
  134. {
  135.     return(TRUE);
  136. }
  137.  
  138. boolean IntroView::givenFocus()
  139. /*
  140.     Our window has just been given input focus
  141. */
  142. {
  143.     /* set the data for the About this Window dialog */
  144.     mainWin->setAboutNames("Intro:About", "cvintrvw.cpp");
  145.  
  146.     /* carry on with default window behavior, return FALSE */
  147.     return(FALSE);
  148. }
  149.  
  150.